 package net.go176.backpack.util;
 
 import com.mojang.authlib.GameProfile;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.inventory.IInventory;
 import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.CompressedStreamTools;
 import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.server.MinecraftServer;
 import net.minecraft.server.management.ItemInWorldManager;
 import net.minecraft.world.World;
 import org.bukkit.entity.HumanEntity;
 
 
 
 public class MCPUtil
 {
   public static NBTTagCompound readNBTfromFile(File file) throws IOException {
     NBTTagCompound nbt;
     FileInputStream input = new FileInputStream(file);
     try {
       nbt = CompressedStreamTools.func_74796_a(input);
     } finally {
       input.close();
     } 
     return nbt;
   }
 
   
   public static void readInventory(IInventory inv, IInventory source) {
     for (int i = 0; i < inv.func_70302_i_() && i < source.func_70302_i_(); i++)
       inv.func_70299_a(i, source.func_70301_a(i)); 
   }
   
   public static void writeInventory(IInventory inv, IInventory source) {
     for (int i = 0; i < inv.func_70302_i_() && i < source.func_70302_i_(); i++)
       source.func_70299_a(i, inv.func_70301_a(i)); 
   }
   
   public static void writeInventorySafely(IInventory inv, IInventory source, HumanEntity viewer) {
     for (int i = 0; i < source.func_70302_i_(); i++) {
       ItemStack item = inv.func_70301_a(i);
       if (source.func_94041_b(i, source.func_70301_a(i)) && (item == null || source.func_94041_b(i, item))) {
         source.func_70299_a(i, item);
       } else if (item != source.func_70301_a(i)) {
         inv.func_70299_a(i, source.func_70301_a(i));
         InvTrans.popUpItem(viewer, NMSUtil.asCraftMirror(item));
       } 
     } 
   }
   
   public static Object newFakePlayer(Object entityPlayerMP) {
     EntityPlayerMP player = (EntityPlayerMP)entityPlayerMP;
     return new EntityPlayerMP(MinecraftServer.func_71276_C(), player.func_71121_q(), new GameProfile(null, "FakePlayerMyBackpack"), new ItemInWorldManager((World)player.func_71121_q()));
   }
 }


/* Location:              D:\User\Xuan\Downloads\MyBackpack1.2.5.jar!\net\saralab\mybackpac\\util\MCPUtil.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.1.3
 */